package org.fuys.coder.common.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Objects;

/**
 * @projectName: fuys-low-coder
 * @package: org.fuys.coder.common
 * @className: Pair
 * @author: WangJing
 * @description: 用于一对值的存储 通用
 * @date: 2024/6/20 11:01
 * @version: 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Pair<L,R> implements Serializable {
    private L left;
    private R right;

    @Override
    public  boolean equals(Object o){
        if(this==o)return true;
        if(!(o instanceof Pair))return false;
        Pair<?,?> pair=(Pair<?, ?>) o;
        return left.equals(pair.left)&& right.equals(pair.right);
    }

    @Override
    public int hashCode(){
        return Objects.hash(left,right);
    }
}
